package Controller.Menu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JPanel;

import Controller.Game.GamePanelController;
import Model.Player.Player;
import Utils.ConstantsImplement;
import Utils.MediaUploder;
import View.Frame.PrincipalFrame;
import View.Game.GamePanel;
import View.Menu.SMenuPanel;

public class SMenuController implements ConstantsImplement{

	//define the Frames and Panels
	private PrincipalFrame principalFrame_;
	private SMenuPanel sMenuPanel_;
	private GamePanelController gamePanelController_;
	public JPanel auxiliarPanel;
	public GamePanel gamePanel;
	private MediaUploder media_;

	//Constructor
	public SMenuController(PrincipalFrame principalFrame, SMenuPanel sMenuPanel, MediaUploder media) {
		// TODO Auto-generated constructor stub
		media_ = media;
		principalFrame_ = principalFrame;
		sMenuPanel_ = sMenuPanel;
		sMenuPanel_.addNyancatButtonActionListener(new NyancatActionListener());
		sMenuPanel_.addNaynCatButtonActionListener(new NayncatActionListener());
	}

	private class NyancatActionListener implements ActionListener{

		public void actionPerformed(ActionEvent e) {
			System.out.println("NYAN");
			gamePanelController_ = new GamePanelController(media_, NYAN_RACE, sMenuPanel_.getOponentIP());
			gamePanelController_.setPrincipalFrame_(principalFrame_);
			//startGamePanel();
		}
	}

	private class NayncatActionListener implements ActionListener{

		public void actionPerformed(ActionEvent e) {
			System.out.println("NAYN");
			gamePanelController_ = new GamePanelController(media_, NAYN_RACE, sMenuPanel_.getOponentIP());
			gamePanelController_.setPrincipalFrame_(principalFrame_);
			//startGamePanel();
		}
	}
	
//	public void startGamePanel(){
//	}

}
